package gui.cen.table;

import gui.cen.Center;
import gui.utils.Borders;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridLayout;
import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.TitledBorder;

/*Author: John Archer, Contact: john.archer.jpa@gmail.com*/
public class ProjectSummary extends JPanel{

    JLabel noOfReadsMapped, noMappedInFowardDir, noMappedInRevDir, meanReadLength;

    public ProjectSummary(Center L1_TableDisplay){
        super(new BorderLayout());
        this.setPreferredSize(new Dimension(150, 100));
        this.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Summary", TitledBorder.LEFT, TitledBorder.TOP, new Font("Tahoma", Font.PLAIN, 10)));
        JPanel p0 = new JPanel();
        p0.setLayout(new GridLayout(4,1));

        p0.add(noOfReadsMapped = createLabel("No. Reads Mapped: ", ""));
        p0.add(noMappedInFowardDir = createLabel("Foward Mapped: ", ""));
        p0.add(noMappedInRevDir = createLabel("Reverse Mapped: ", ""));
        p0.add(meanReadLength = createLabel("Mean Read Length: ", ""));

        this.add(p0, BorderLayout.CENTER);
    }

    public void setAllLabels(String nm, String fm, String rm, String mrl){
        noOfReadsMapped.setText("No. Reads Mapped: "+nm);
        noMappedInFowardDir.setText("Foward Mapped: "+fm);
        noMappedInRevDir.setText("Reverse Mapped: "+rm);
        meanReadLength.setText("Mean Read Length: "+mrl);
    }


    private JLabel createLabel(String title, String value){
        JLabel label = new JLabel();
        label.setForeground(Color.DARK_GRAY);
        label.setFont(Borders.getFont(Borders.GUIFONT));
        label.setText(title+": "+value);
        return label;
    }

}
